<?xml version="1.0"?> 
<xsl:stylesheet	version="1.0" 
				xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
				xmlns:captor="captor.lib.xalan.extensions.CaptorExtension"
				extension-element-prefixes="captor">

	<!--______________________________________________________________________-->
	<xsl:output method="text"/>
	<!--______________________________________________________________________-->

	<xsl:template match="/">

		package logging;

		public aspect LoggingAspect {

			/** Indent width */
			private final int width = 2;
			/** Current indent with counter */
			private int indent = 0;

			/**
			 * This will be implemented by logging aspects.
			 */

			public pointcut logging() : <captor:abstractpointcutlist refname="logList"/>;

			before() : call (public * java.io.PrintStream.println(..)){
				for (int spaces = 0, indent = this.indent * this.width; spaces &lt; indent; spaces++) {
					System.out.print(" ");
				}
			}
			
			before() : logging()
			{
				final String joinPointName = thisJoinPoint.getThis().getClass()
						.getSimpleName()
						+ "." + thisJoinPoint.getSignature().getName() + "()";
				this.indent++;
				System.out.println("Entering [" + joinPointName + "]");
			}
			
			after() : logging()
			{
				final String joinPointName = thisJoinPoint.getThis().getClass()
				.getSimpleName()
				+ "." + thisJoinPoint.getSignature().getName() + "()";
				System.out.println("Leaving  [" + joinPointName + "]");
				this.indent--;
			}
		}

	</xsl:template>
	
</xsl:stylesheet>